@import _variables.sass

// Auto clear
@mixin autoclear
  &:after
    content: "."
    display: block
    height: 0
    clear: both
    visibility: hidden    

@mixin clearbefore
  &:before
    content: "."
    display: block
    height: 0
    clear: both
    visibility: hidden   
    
@mixin sprites($background-position: 0 100%, $indent: -9999px, $bg-color: transparent)
  background: url("../images/sprites.png") no-repeat scroll $background-position $bg-color
  text-indent: $indent
  border: medium none
  outline: 0

@mixin sprites_x($background-position: 0 100%, $bg-color: transparent)
  background: url("../images/sprites-x.png") no-repeat scroll $background-position $bg-color      

@mixin h2_title
  background: url("../images/h2_title.png") no-repeat transparent    
    
@mixin inlineblock
  zoom: 1
  *display: inline
  display: inline-block
  
@mixin font_time_xxx($size: 21px, $weight: bold)
  font-size: $size
  font-family: "Times New Roman"
  font-weight: $weight

@mixin font_myriad($size: 21px, $weight: normal)
  font-size: $size
  font-family: "MyriadPro-Regular"
  font-weight: $weight    

@mixin font_myriad_bold($size: 21px, $weight: bold)
  font-size: $size
  font-family: "MyriadPro-Bold"
  font-weight: $weight      

@mixin font_myriad_black($size: 21px, $weight: normal)
  font-size: $size
  font-family: "MyriadPro-Black"
  font-weight: $weight     

@mixin font_myriad_cond($size: 19px, $weight: normal)
  font-size: $size
  font-family: "MyriadPro-Cond"
  font-weight: $weight      

@mixin font_myriad_boldcond($size: 19px, $weight: bold)
  font-size: $size
  font-family: "MyriadPro-BoldCond"
  font-weight: $weight     
      
// Rounded corners mixin.
@mixin rounded_corners($top: 10px, $right: $top, $bottom: $top, $left: $right, $ie_position: relative, $behavior: url("/sites/all/themes/cuahang/pie/PIE.htc"))
  border-radius: $top $right $bottom $left
  -moz-border-radius: $top $right $bottom $left
  -webkit-border-top-left-radius: $top
  -webkit-border-top-right-radius: $right
  -webkit-border-bottom-right-radius: $bottom
  -webkit-border-bottom-left-radius: $left  
  behavior: $behavior
  position: $ie_position
  
@mixin linear_gradient($start, $end, $ie_position: relative, $behavior: url("/sites/all/themes/cuahang/pie/PIE.htc")) 
  background: $end
  background: -webkit-gradient(linear, 0 0, 0 bottom, from($start), to($end))
  background: -webkit-linear-gradient($start, $end)
  background: -moz-linear-gradient($start, $end)
  background: -ms-linear-gradient($start, $end)
  background: -o-linear-gradient($start, $end)
  background: linear-gradient($start, $end)
  -pie-background: linear-gradient($start, $end)
  behavior: $behavior
  position: $ie_position  
  
@mixin linear_gradient_3point($start, $end, $from, $ie_position: relative, $behavior: url("/sites/all/themes/cuahang/pie/PIE.htc")) 
  background: $end
  background: -webkit-gradient(linear, 0 0, 0 bottom, from($start), to($end))
  background: -webkit-linear-gradient($from, $start, $end)
  background: -moz-linear-gradient($from, $start, $end)
  background: -ms-linear-gradient($from, $start, $end)
  background: -o-linear-gradient($from, $start, $end)
  background: linear-gradient($from, $start, $end)
  -pie-background: linear-gradient($from, $start, $end, $end)
  behavior: $behavior
  position: $ie_position  

@mixin linear_gradient_reflected($start, $end, $orientation, $ie_position: relative, $behavior: url("/sites/all/themes/cuahang/pie/PIE.htc")) 
  background: $end  
  background-image: -webkit-gradient(linear, 0% 100%, 100% 0%, color-stop(0%, $start), color-stop(50%, $end), color-stop(100%, $start))
  background-image: -webkit-linear-gradient($orientation, $start 0%, $end 50%, $start 100%)
  background-image: -moz-linear-gradient($orientation, $start 0%, $end 50%, $start 100%)
  background: -ms-linear-gradient($orientation, $start 0%, $end 50%, $start 100%)
  background-image: -o-linear-gradient($orientation, $start 0%, $end 50%, $start 100%)
  background-image: linear-gradient($orientation, $start 0%, $end 50%, $start 100%)  
  -pie-background: linear-gradient($orientation, $start 0%, $end 50%, $start 100%)
  behavior: $behavior
  position: $ie_position
  
@mixin font_face_include($fullname: 'MyriadPro-Regular', $machine: myriadpro-regular, $fontweight: normal)
  font-family: $fullname
  src: url("../fonts/#{$machine}.eot")
  src: url("../fonts/#{$machine}.eot?#iefix") format("embedded-opentype"), url("../fonts/#{$machine}.woff") format("woff"), url("../fonts/#{$machine}.ttf") format("truetype"), url("../fonts/#{$machine}.svg##{$machine}") format("svg")
  font-weight: normal
  font-style: $fontweight
  
    
@mixin view_accordion_clear()
  > .view-content
    .views-row
      > .views-field
        background: transparent        
        border: medium none
        &.ui-state-active
          display: none        
        > .ui-icon
          display: none
      > .ui-accordion-content        
        border: medium none  

@mixin view_accordion_clear_not_view()  
  .ui-accordion 
    .ui-accordion-header
      background: transparent        
      border: medium none             
      .ui-icon
        display: none
    .ui-accordion-content        
      border: medium none  
      background: transparent

@mixin jquery-text-shadow($shadow-1: default, $shadow-2: false, $shadow-3: false, $shadow-4: false, $shadow-5: false, $shadow-6: false, $shadow-7: false, $shadow-8: false, $shadow-9: false, $shadow-10: false)
  // for supported browers
  @include text-shadow($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10)

  @if $shadow-1 == default
    $shadow-1: $default-text-shadow-color $default-text-shadow-h-offset $default-text-shadow-v-offset $default-text-shadow-blur
  $shadows: ($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10)
  $i: 1
  @each $shadow in $shadows
    @if $shadow
      $length: length($shadow)
      
      // some defaults
      $color: inherit
      $opacity: 100
      $offset-x: 0
      $offset-y: 0
      $blur-radius: 0
      $spread: 0 // IE10 only, not used

      // pull apart the individual arguments from the list
      @if type-of(nth($shadow, 1)) == color
        // color first, blur optional, spread optional
        @if $length >= 1
          $color: nth($shadow, 1)
        @if $length >= 2
          $offset-x: nth($shadow, 2)
        @if $length >= 3
          $offset-y: nth($shadow, 3)
        @if $length >= 4
          $blur-radius: nth($shadow, 4)
        @if $length == 5
          $spread: nth($shadow, 5)
      @else
        // color last or missing, blur optional, spread optional
        @if type-of(nth($shadow, $length)) == color
          $color: nth($shadow, $length)
      
        @if $length >= 1
          $offset-x: nth($shadow, 1)
        @if $length >= 2
          $offset-y: nth($shadow, 2)
        @if $length >= 3
          @if type-of(nth($shadow, 3)) != color
            $blur-radius: nth($shadow, 3)
        @if $length >= 4
          @if type-of(nth($shadow, 4)) != color
            $spread: nth($shadow, 4)

      // seperate the color from the opacity
      @if $color != inherit
        $opacity: round(alpha($color) * 100)
        $color: rgb(red($color), green($color), blue($color))
      
      // remove the unit from the radius
      @if unit($blur-radius) == px
        $blur-radius: $blur-radius / 1px

      color: $color
      filter: if( $opacity <= 100, unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$opacity})"), unquote("") ) 
      filter: if( $blur-radius > 0, unquote("progid:DXImageTransform.Microsoft.Blur(makeShadow=false,pixelRadius=#{$blur-radius})"), unquote("") )
      left: $offset-x - $blur-radius
      top: $offset-y - $blur-radius
